OpenStack Havana - Set Floating IP
2013/10/22 |
It's possible to access to Virtual machine Instance to set Floating IP address.
|
|
[1] | Change Nova's setting first to assign Floating IP address automatically. |
[root@dlp ~(keystone)]#
vi /etc/nova/nova.conf # line 999 : uncomment and change auto_assign_floating_ip= True
/etc/rc.d/init.d/openstack-nova-network restart Stopping openstack-nova-network: [ OK ] Starting openstack-nova-network: [ OK ] |
[2] | Set Floating IP address. For exmaple, assign 10.0.0.248/29 for Floating IP addresses in internal network 10.0.0.0/24. |
[root@dlp ~(keystone)]# nova-manage floating create --ip_range=10.0.0.248/29 [root@dlp ~(keystone)]# nova-manage floating list None 10.0.0.249 None nova eth0 None 10.0.0.250 None nova eth0 None 10.0.0.251 None nova eth0 None 10.0.0.252 None nova eth0 None 10.0.0.253 None nova eth0 None 10.0.0.254 None nova eth0 |
[3] | Create a new instance and boot it, then Floating IP is assgined automatically like follows. In the example below, The "10.0.0.249" is just the Floating IP. |
# create and boot Instance [root@dlp ~(keystone)]# nova boot --flavor 2 --image CentOS6 --security_group default CentOS_64_Pub [root@dlp ~(keystone)]# nova list +------------+---------------+---------+------------+-------------+--------------------------------+ | ID | Name | Status | Task State | Power State | Networks | +------------+---------------+---------+------------+-------------+--------------------------------+ | 081bba5e-0 | CentOS_64 | SHUTOFF | None | Shutdown | network01=10.1.0.2 | | 4cf02c97-b | CentOS_64_Pub | ACTIVE | None | Running | network01=10.1.0.3, 10.0.0.249 | +------------+---------------+---------+------------+-------------+--------------------------------+ |
[4] | The Instances created before setting Floating IP, Floating IP does not assigned automatically, so it necessarry to set it manually like follows. |
[root@dlp ~(keystone)]# nova list +------------+---------------+---------+------------+-------------+--------------------------------+ | ID | Name | Status | Task State | Power State | Networks | +------------+---------------+---------+------------+-------------+--------------------------------+ | 081bba5e-0 | CentOS_64 | SHUTOFF | None | Shutdown | network01=10.1.0.2 | | 4cf02c97-b | CentOS_64_Pub | SHUTOFF | None | Shutdown | network01=10.1.0.3, 10.0.0.249 | +------------+---------------+---------+------------+-------------+--------------------------------+ # assign "10.0.0.250" to "CentOS_64" [root@dlp ~(keystone)]# nova add-floating-ip CentOS_64 10.0.0.250 [root@dlp ~(keystone)]# nova list +------------+---------------+---------+------------+-------------+--------------------------------+ | ID | Name | Status | Task State | Power State | Networks | +------------+---------------+---------+------------+-------------+--------------------------------+ | 081bba5e-0 | CentOS_64 | SHUTOFF | None | Shutdown | network01=10.1.0.2, 10.0.0.250 | | 4cf02c97-b | CentOS_64_Pub | SHUTOFF | None | Shutdown | network01=10.1.0.3, 10.0.0.249 | +------------+---------------+---------+------------+-------------+--------------------------------+ |